import { AutoFeedCheckBoxSprite } from "../autoFeed/AutoFeedCheckBoxSprite";
import { ObjCreate } from "../common/ObjCreate";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
import { DisplayUtil } from "../../../common/DisplayUtil";
import { GTextFiled } from "../../../../com/mui/controls/GTextFiled";
//class MountsToolTipPropSp
    
    export  class MountsToolTipPropSp extends AutoFeedCheckBoxSprite
    {
        constructor()
        {
            super();
            this.initView();
            return;
        }

        /* internal  */initView(): void
        {
            this._txTitel = ObjCreate.createGTextField("", 2, 1, 100, 20, this, GlobalStyle.textFormatOrange);
            this._propArr = [];
            return;
        }

        public setData(arg1: Array<any>, arg2: Boolean, arg3: string): void
        {
            var loc1=null;
            var loc3=null;
            var loc4=0;
            var loc5=0;
            this.cleanAll();
            this._verticalFlag = arg2;
            var loc2=arg1.length;
            var loc6=Math.ceil(loc2 / 2);
            var loc7=0;
            while (loc7 < loc2) 
            {
                loc3 = arg1[loc7];
                if (arg2) 
                {
                    loc4 = 0;
                    loc5 = 20 + loc7 * 20;
                    (loc1 = ObjCreate.createGTextField("", loc4, loc5, 100, 20, this)).htmlText = HTMLUtil.addColor(loc3["name"] + "： " + loc3["value"], arg3);
                }
                else 
                {
                    loc4 = Math.floor(loc7 / loc6) * 100;
                    loc5 = 20 + Math.floor(loc7 % loc6) * 20;
                    (loc1 = ObjCreate.createGTextField("", loc4, loc5, 100, 20, this)).htmlText = HTMLUtil.addColor(loc3["name"] + "： " + loc3["value"], arg3);
                }
                this._propArr.push(loc1);
                ++loc7;
            }
            return;
        }

        public setTitleTx(arg1: string): void
        {
            this._txTitel.text = arg1;
            return;
        }

        /* internal  */cleanAll(): void
        {
            var loc1=this._propArr.length;
            var loc2=0;
            while (loc2 < loc1) 
            {
                DisplayUtil.removeMe(this._propArr[loc2]);
                ++loc2;
            }
            this._propArr = [];
            return;
        }

        public /* override */ get height(): number
        {
            if (this._verticalFlag) 
            {
                return 20 + this._propArr.length * 20;
            }
            return 20 + Math.ceil(this._propArr.length / 2) * 20;
        }

        /* internal */ /* var */_txTitel: GTextFiled;

        /* internal */ /* var */_propArr: Array<any>;

        /* internal */ /* var */_verticalFlag: Boolean;
    }
